package edu.utn.tacs.grupouno.ui.client;

import java.util.Date;

import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.TimeZone;

public class DateUtil {

	private static final TimeZone TIME_ZONE = TimeZone.createTimeZone(-3);
	private static final DateTimeFormat FORMAT = DateTimeFormat.getFormat("dd-MM-yyyy");
	private static final DateTimeFormat FULL_FORMAT = DateTimeFormat.getFormat("dd-MM-yyyy hh:mm");

	public static String toString(Date date) {
		return FORMAT.format(date, TIME_ZONE);
	}
	
	public static Date fromString(String date) {
		return FORMAT.parse(date);
	}
	
	public static Date fromStrings(String date, String time) {
		return FULL_FORMAT.parse(date + " " + time);
	}
	
	public static DateTimeFormat getFormat() {
		return FORMAT;
	}
}
